package service.impl;

import dao.CompanyDao;
import dao.impl.CompanyDaoImpl;
import model.Company;
import service.CompanyService;

import java.util.List;

/**
 * @Author: 燕子豪
 * @Date: 2022/12/17 20:32
 */
public class CompanyServiceImpl implements CompanyService {
    CompanyDao companyDao = new CompanyDaoImpl();
    @Override
    public Company login(String cname, String cpassword) {
        return companyDao.login(cname,cpassword);
    }

    @Override
    public Boolean update(Company company) {
        return companyDao.update(company) == 1;
    }

    @Override
    public Boolean insert(Company company) {
        return companyDao.insert(company) == 1;
    }

    @Override
    public List<Company> selectAll(int pageIndex, int pageSize) {
        return companyDao.selectAll(pageIndex,pageSize);
    }

    @Override
    public List<Company> selectByName(String cname, int pageIndex, int pageSize) {
        return companyDao.selectByName(cname,pageIndex,pageSize);
    }

    @Override
    public int countAll() {
        return companyDao.countAll();
    }

    @Override
    public int countByName(String cname) {
        return companyDao.countByName(cname);
    }

    @Override
    public Company selectById(long cid) {
        return companyDao.selectById(cid);
    }
}
